package com.newcoin.chat.service;

import com.newcoin.chat.beans.entity.GroupApplicationEntity;
import com.newcoin.chat.beans.entity.GroupMemberEntity;
import com.newcoin.chat.beans.vo.*;

import java.util.List;

public interface GroupService {
    /**
     * 创建群聊
     *
     * @param userId
     * @param userIds
     * @return
     * @throws Exception
     */
    ResultVo<Object> createGroup(long userId, String userIds, String sign) throws Exception;

    /**
     * 修改群名称
     *
     * @param userId
     * @param groupId
     * @param name
     * @return
     * @throws Exception
     */
    ResultVo modifyGroupName(long userId, long groupId, String name) throws Exception;

    /**
     * 是否有新的群邀请信息
     *
     * @param userId
     * @return
     * @throws Exception
     */
    ResultVo<Boolean> isThereANewGroupApplication(long userId) throws Exception;

    /**
     * 获取最近10条邀请进群群通知
     *
     * @param userId
     * @return
     * @throws Exception
     */
    ResultVo<List<GroupApplicationEntity>> groupInviteMessages(long userId) throws Exception;

    /**
     * 获取所有的邀请进群群通知
     *
     * @param userId
     * @param page
     * @return
     * @throws Exception
     */
    ResultVo<GroupApplicationVo> getAllGroupApplicationMessages(long userId, int page) throws Exception;

    /**
     * 通过或者拒绝群邀请
     *
     * @param groupApplicationId
     * @param state
     * @return
     * @throws Exception
     */
    ResultVo<String> passOrRejectGroupApplication(long groupApplicationId, int state) throws Exception;

    /**
     * 移出群聊
     *
     * @param userId
     * @param groupId
     * @param groupMemberId
     * @return
     * @throws Exception
     */
    ResultVo removeUser(long userId, long groupId, long groupMemberId) throws Exception;

    /**
     * 群成员退出群聊
     *
     * @param userId
     * @param groupId
     * @return
     * @throws Exception
     */
    ResultVo dropOutGroup(long userId, long groupId) throws Exception;

    /**
     * 邀请好友进群（可以是群主  也可以是群成员）
     *
     * @param userId
     * @param friendId
     * @param groupId
     * @return
     * @throws Exception
     */
    ResultVo inviteFriendAddGroup(long userId, long friendId, long groupId) throws Exception;

    /**
     * 群主打开或关闭阅后即焚
     *
     * @param userId
     * @param state
     * @return
     * @throws Exception
     */
    ResultVo openOrCloseAfterReadingIncineration(long userId, long groupId, int state) throws Exception;

    /**
     * 根据群id获取群信息
     *
     * @param groupId
     * @return
     * @throws Exception
     */
    ResultVo<GroupInfoVo> getGroupInfoByGroupId(long groupId) throws Exception;


    /**
     * 获取群成员
     *
     * @param groupId
     * @return
     * @throws Exception
     */
    ResultVo<List<UserVo>> getGroupMember(long groupId) throws Exception;


    /**
     * 获取与朋友的阅后即焚状态
     *
     * @param groupId
     * @return
     */
    ResultVo<Integer> getAfterReadingIncinerationState(long groupId) throws Exception;


    /**
     * 获取朋友发来的离线消息
     *
     * @param userId
     * @param groupId
     * @return
     * @throws Exception
     */
    ResultVo<List<GroupOfflineMsgVo>> getOfflineMessage(Long userId, Long groupId) throws Exception;

    /**
     * 修改群聊
     *
     * @param groupId
     * @param groupName
     * @return
     * @throws Exception
     */
    ResultVo updateGroupName(Long groupId, String groupName) throws Exception;

    /**
     * 获取用户所有的群
     * @param userId
     * @return
     * @throws Exception
     */
    void getGroupMemberByUserId(Long userId) throws Exception;

}
